// 选票案例
#include <stdio.h>
#include <string.h>

typedef struct candidate
{
    char name[32];
    int vote;
}CAN;

int main(int argc, char **argv)
{
    CAN candi[3] = {{"lala", 0}, {"kaka", 0}, {"haha", 0}};
    char name[32] = "";
    int i = 0;

    while (1)
    {
        printf("输入\n");
        scanf("%s", name);

        if (strcmp(name, "lala") == 0)
        {
            candi[0].vote++;
        }
        else if (strcmp(name, "kaka") == 0)
        {
            candi[1].vote++;
        }
        else if (strcmp(name, "haha") == 0)
        {
            candi[2].vote++;
        }
        else if (strcmp(name, "qt") == 0)
        {
            break;
        }
        else 
        {
            continue;
        }
    }

    // 输出
    for (i = 0; i < 3; i++)
    {
        printf("%s %d\n", candi[i].name, candi[i].vote);
    }

    return 0;
}